import re
import time
import uuid

import requests

url_page = 'https://m.mm.enterdesk.com/dongmanmeinv/'
res = requests.get(url=url_page)
# print(res.text)
urls = re.findall(r'https://up.enterdesk.com/edpic_360_360.*?\.jpg', res.text)

for url in urls:
    res = requests.get(url=url)
    time.sleep(2)
    content = res.content
    name = str(uuid.uuid1()) + ".jpg"
    with open(name, 'wb')as f:
        print('正在下载%s' % name)
        f.write(content)

# # 发送请求
# url = "https://up.enterdesk.com/edpic_source/28/01/c4/2801c499eb16abbc18924826cf25fcb7.jpg"
# res = requests.get(url=url)
# # 将响应数据转化为二进制流数据
# content = res.content
# # 将二进制数据流数据写入文件
# with open('./xxx.jpg','wb') as f:
#     f.write(content)
